#%RAML 1.0
title: Codex
baseUri: https://github.com/folio-org/mod-codex-ekb
version: v1

documentation:
 - title: Codex API
   content: This documents the FOLIO codex API

types:
  instance: !include ../../schemas/codex/instance.json
  instanceCollection: !include ../../schemas/codex/instanceCollection.json
  errors: !include ../../schemas/errors.schema

traits:
  validate: !include ../../traits/validation.raml
  language: !include ../../traits/language.raml
  pageable: !include ../../traits/pageable.raml
  searchable: !include ../../traits/searchable.raml

resourceTypes:
  get-only: !include ../../rtypes/get-only.raml
  collection-item-get: !include ../../rtypes/item-collection-get.raml

/codex-instances:
  displayName: Codex instances
  description: Codex instance collection
  type:
    get-only:
      schema: instanceCollection
      exampleCollection: !include ../../examples/codex/instanceCollection.sample
  get:
    is: [
      searchable: {description: "with valid searchable fields: for example title = earth", example: "title=earth"},
      pageable,
      validate
    ]
    responses:
      401:
        description: "Not authorized to perform requested action"
        body:
          text/plain:
            example: |
              "unable to list instances -- unauthorized"
  /{id}:
    displayName: Codex instance
    description: Get a specific codex instance
    type:
      collection-item-get:
        schema: instance
        exampleItem: !include ../../examples/codex/instance.sample
